<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<table border="1">
		<tr>
			<th><input id="all" type="checkbox"></th>
			<th>姓名</th>
			<th>年龄</th>
			<th>电话</th>
		</tr>
		<tr>
			<td><input id="c1" name="chk" type="checkbox"></td>
			<td>aaa</td>
			<td>bbb</td>
			<td>ccc</td>
		</tr>
		<tr>
			<td><input id="c2" name="chk" type="checkbox"></td>
			<td>aaa</td>
			<td>bbb</td>
			<td>ccc</td>
		</tr>
		<tr>
			<td><input id="c3" name="chk" type="checkbox"></td>
			<td>aaa</td>
			<td>bbb</td>
			<td>ccc</td>
		</tr>
		<tr>
			<td><input id="c4" name="chk" type="checkbox"></td>
			<td>aaa</td>
			<td>bbb</td>
			<td>ccc</td>
		</tr>
		<tr>
			<td><input id="c5" name="chk" type="checkbox"></td>
			<td>aaa</td>
			<td>bbb</td>
			<td>ccc</td>
		</tr>
	</table>
	
	<script>
	
		var initcheckBox = function (){
			var all = document.getElementById('all');
			var chk = document.getElementsByName('chk');
			var len = chk.length;
			all.onclick = function() {
				var status = '';
				if(this.checked){
					status = 'checked';
				}else {
					status = '';
				}
					
			}
				
		}
		initcheckBox;
		
	</script>
	</body>
</html>
